package cn.zr.aitool.activitys;

import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import cn.zr.aitool.R;

public class JiJinDetailActivity extends BaseDetailActivity {

    ImageView imageView;
    TextView mTvContent;
    TextView mTvTitle;
    TextView mTvStart;
    TextView mTvEnd;
    TextView mTvContent1;
    TextView mTvContent2;
    TextView mTvContent3;
    TextView mTvTotalCount;
    TextView mTvTotalCost;
    TextView mTvAvgCost;
    TextView mTvNextBuy;

    @Override
    protected void initView() {
        setContentView(R.layout.activity_item_detail);
        Toolbar toolbar = findViewById(R.id.toolbar);
        imageView = findViewById(R.id.item_detail_iv);
        mTvContent = findViewById(R.id.detail_content);
        mTvContent1 = findViewById(R.id.detail_content_1);
        mTvContent2 = findViewById(R.id.detail_content_2);
        mTvContent3 = findViewById(R.id.detail_content_3);
        mTvTotalCount = findViewById(R.id.detail_total_count);
        mTvTotalCost = findViewById(R.id.detail_total_cost);
        mTvAvgCost = findViewById(R.id.detail_avg_cost);
        mTvTitle = findViewById(R.id.detail_title);
        mTvStart = findViewById(R.id.detail_start);
        mTvEnd = findViewById(R.id.detail_end);
        mTvNextBuy = findViewById(R.id.detail_next_buy);
        setSupportActionBar(toolbar);
    }

    @Override
    protected void setData() {
        super.setData();
        setOrHideView(mTvEnd, end);
        setOrHideView(mTvStart, start);
        setOrHideView(mTvContent, content);
        setOrHideView(mTvTitle, title);
        setOrHideView(mTvContent1, content1);
        setOrHideView(mTvContent2, content2);
        setOrHideView(mTvContent3, content3);
    }

    @Override
    protected void getDataByTitle() {

    }

    private void setOrHideView(TextView view, String text) {
        if (TextUtils.isEmpty(text)) {
            view.setVisibility(View.GONE);
        } else {
            view.setVisibility(View.VISIBLE);
            view.setText(text);
        }
    }

}
